package cn.diancan.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Version;

import cn.diancan.util.DateUtil;


@Entity
public class SpecificationValue  {
	
	private Long id;//主键
	private String value; // 规格值名称
	
	private String valueKey; //键- 有延伸意 可以对应其他表的id  
	
	private Integer orderNo; // 排序
	private String createTime;
	private Integer isDelete;//删除标识
	//private Long specificationId; // 规格Id 
	private Specification specification;
	    private Integer version;
	    
	    @Version
	    @Column(name="OPTLOCK",columnDefinition="int(11) DEFAULT 0")
	    public Integer getVersion() {
	        return version;
	    }
	    public void setVersion(Integer version) {
	        this.version = version;
	    }
	
	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	
	public Integer getOrderNo() {
	    return orderNo;
	}
	public void setOrderNo(Integer orderNo) {
	    this.orderNo = orderNo;
	}
	public Integer getIsDelete() {
		return isDelete;
	}
	public void setIsDelete(Integer isDelete) {
		this.isDelete = isDelete;
	}
	/*public Long getSpecificationId() {
		return specificationId;
	}
	public void setSpecificationId(Long specificationId) {
		this.specificationId = specificationId;
	}*/
	
	@Column(name="createTime",columnDefinition="DATETIME")
	public String getCreateTime() {
	    return DateUtil.getMysqlDateTime(createTime);
	}
	public void setCreateTime(String createTime) {
	    this.createTime = createTime;
	}
	
	@ManyToOne(cascade=CascadeType.ALL,fetch = FetchType.LAZY)
	@JoinColumn(name="specificationId")
 	public Specification getSpecification() {
		return specification;
	}
 	
	public void setSpecification(Specification specification) {
		this.specification = specification;
	}
	public String getValueKey() {
	    return valueKey;
	}
	public void setValueKey(String valueKey) {
	    this.valueKey = valueKey;
	} 
	
	
	
	 
}
